package com.meida.module.bus.provider.handler;

import com.meida.common.base.entity.EntityMap;
import com.meida.common.mybatis.interceptor.PageInterceptor;
import com.meida.common.mybatis.model.PageParams;
import com.meida.common.mybatis.query.CriteriaQuery;
import com.meida.module.bus.client.entity.BusOrder;
import com.meida.module.bus.client.entity.BusOrderAnswer;
import com.meida.module.user.client.entity.AppUser;
import org.springframework.stereotype.Component;

/**
 * 后台订单报价列表
 */
@Component
public class BusOrderQuotedPageListHandler implements PageInterceptor<BusOrderAnswer> {
    //type定义：1：图片 2：视频 ，3：附件 4：图文 5：表格 6：链接

    @Override
    public void prepare(CriteriaQuery<BusOrderAnswer> cq, PageParams pageParams, EntityMap params) {
        cq.clear();
        cq.select(BusOrderAnswer.class, "answerId", "orderId", "answerState", "quotedPrice", "bargainPrice", "isAnswer", "createTime");
        cq.select(BusOrder.class, "orderNo");
        cq.select(AppUser.class, "nickName");
        cq.eq(BusOrderAnswer.class, "answerState");
        cq.eq(BusOrderAnswer.class, "orderId");
        cq.createJoin(BusOrder.class).setMainField("orderId").setJoinField("orderId");
        cq.createJoin(AppUser.class).setMainField("answerUserId").setJoinField("userId");
    }


}
